package com.aaie.gru.payproof.service.impl;

import com.aaie.gru.payproof.entity.GruSysPayProof;
import com.aaie.gru.payproof.entity.GruSysPayProofDto;
import com.aaie.gru.payproof.entity.GruSysPayProofVo;
import com.aaie.gru.payproof.mapper.GruSysPayProofMapper;
import com.aaie.gru.payproof.service.IGruSysPayProofService;
import com.aaie.gru.theme.entity.GruSysThemeFeedbackVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lvxing
 * @since 2019-08-09
 */
@Service
public class GruSysPayProofServiceImpl extends ServiceImpl<GruSysPayProofMapper, GruSysPayProof> implements IGruSysPayProofService {

    @Resource
    GruSysPayProofMapper gruSysPayProofMapper;

    @Override
    public IPage<GruSysPayProofVo> getGruSysPayProofVoList(GruSysPayProofDto param) {
        // 定义分页
        Page<GruSysPayProofVo> page = new Page<>(param.getCurrent(), param.getSize());
        // 查询条件
        QueryWrapper<GruSysPayProofVo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(StringUtils.isNotEmpty(param.getStuId()), "pp.stu_id", param.getStuId());
        // 按更新时间倒叙排序
        queryWrapper.orderByDesc("pp.update_time_sort");
        return gruSysPayProofMapper.selectGruSysPayProofVoList(page, queryWrapper);
    }
}
